package com.example.coursehub.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;

import java.io.Serializable;
import java.util.Objects;

@Getter
@Setter
@Embeddable
public class ClassesMaterialId implements Serializable {
    private static final long serialVersionUID = 9129243774069277996L;
    @Column(name = "classes_id", nullable = false, length = 100)
    private String classesId;

    @Column(name = "material_id", nullable = false, length = 100)
    private String materialId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
        ClassesMaterialId entity = (ClassesMaterialId) o;
        return Objects.equals(this.classesId, entity.classesId) &&
                Objects.equals(this.materialId, entity.materialId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(classesId, materialId);
    }

}